Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Print  Text  Files  to  a  Printer  Other  than  the  Default  Printer  

 Content of Print Text Files to a Printer Other than the Default Printer.vbs
MD5 Hash: 8DF5B3CE62632217531CF360881CD800
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Default = TRUE")

For Each objPrinter in colPrinters
strOldDefault = objPrinter.Name
strOldDefault = Replace(strOldDefault, "\", "\\")
Next

Set colPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Name = '\\\\atl-ps-01\\printer2'")

For Each objPrinter in colPrinters
objPrinter.SetDefaultPrinter()
Next

Wscript.Sleep 2000

TargetFolder = "C:\Logs"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(TargetFolder)
Set colItems = objFolder.Items
For Each objItem in colItems
objItem.InvokeVerbEx("Print")
Next

Set colPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Name = '" & strOldDefault & "'")

For Each objPrinter in colPrinters
objPrinter.SetDefaultPrinter()
Next



   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a